﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using LandPortMoblieWeb.Models;

namespace LandPortMoblieWeb.Helper
{
    public class HelpCookies
    {
        /// <summary>
        /// 当前用户
        /// </summary>
        public static User CurrentUserObject;

        public void SetCookise(string cookname,string storeinfo)
        {
            HttpCookie cok = new HttpCookie(cookname);
            cok.Value = storeinfo;
            cok.Expires = DateTime.Now.AddDays(7);
            HttpContext.Current.Response.Cookies.Add(cok);
        }

        public string GetCookiseInfo(string cookname)
        {
            var str = "";
            if (HttpContext.Current.Request.Cookies[cookname] != null)
            {
                str = HttpContext.Current.Request.Cookies[cookname].Value;
            }
            return str;
        }

        public void DelCookise(string cookname)
        {
            HttpCookie cok = new HttpCookie(cookname);
            cok.Expires = DateTime.Now.AddDays(-1);
            HttpContext.Current.Response.Cookies.Add(cok);
        }
    }
}